//
//  CYGLeftMenuCityView.m
//  CYGHuntForCity
//
//  Created by cygarm on 16/2/21.
//  Copyright © 2016年 cygarm. All rights reserved.
//

#import "CYGLeftMenuCityView.h"

@interface CYGLeftMenuCityView()
@property (weak, nonatomic) IBOutlet UIButton *btn1;
@property (weak, nonatomic) IBOutlet UIButton *btn2;
@property (weak, nonatomic) IBOutlet UIButton *btn3;
@end

@implementation CYGLeftMenuCityView

//- (instancetype)init≥WithCoder:(NSCoder *)aDecoder {
//	if (self = [super initWithCoder:aDecoder]) {
//		UIView *view = [[[NSBundle mainBundle] loadNibNamed:NSStringFromClass([self class]) owner:nil options:nil] lastObject];
//		[self addSubview:view];
//	}
//	return self;
//}

- (instancetype)initWithFrame:(CGRect)frame {
	if (self = [super initWithFrame:frame]) {
		self =  [[[NSBundle mainBundle] loadNibNamed:NSStringFromClass([self class]) owner:nil options:nil] lastObject];
		[self setUp];
	}
	return self;
}

- (void)awakeFromNib {
	[super awakeFromNib];
	[self setUp];
}

- (void)initCities:(NSArray *)cities {
	UIButton *btn;
	for (int i = 1; i < cities.count; ++i) {
		btn = [self viewWithTag:i];
		[btn setTitle:cities[i] forState:UIControlStateNormal];
	}
}

- (void)setUp {
	self.layer.masksToBounds = YES;
	self.layer.cornerRadius = CYGCornerRadius;
}

- (IBAction)btnClick:(id)sender {
	UIButton *btn = (UIButton *)sender;
	if ([self.delegate respondsToSelector:@selector(leftMenuCityViewBtnClicked:)]) {
		[self.delegate leftMenuCityViewBtnClicked:[btn tag]];
	}
}





@end
